<script type="text/javascript">
	function delete_product(id)
	{
		if (confirm('vous voulez supprimer ce produit ?')) {
			
			jQuery('form[name=deleteproduct]').submit();
			
		   }
		}

</script>

<div class="nav">
<?php if(isset($_GET['category_id'])){?>
 <a class="gohome" href="<?=site_url('admin990/catalogue')?>/<?=$_GET['category_id']?>/<?=$product->cat_id?>"> RETOUR</a> 
 <?php }else{?>
 	<a class="gohome" href="<?=site_url('admin990/catalogue')?>/<?=$product->cat_id?>"> RETOUR</a> 
<?php }?>
<?php if(isset($_GET['category_id'])){
 $url = current_url().'?category_id='.$_GET['category_id'];
}else{
 $url = current_url();
}?>
<div class="clear"></div>

</div>
<div class="product_ctn">
<div class="product">
	<h3><?=$product->product_name?></h3>
	<form action="" name="product_status" method="post">
<?php if($product->status != null){?><img src="<?=base_url()?>/resources/imgs/block_yes.png" height="14" alt="disponible" title="disponible"><?php }else{?><img src="<?=base_url()?>/resources/imgs/block_no.png" height="12" alt="non disponible" title="non disponible"> <?php }?>  
<select name="status" onchange="document.product_status.submit()">
<option value="1" <?php if($product->status !=null){?>seleced="selected"<?php }?> >Activé</option>
<option value="null" <?php if($product->status == null){?>selected="selected"<?php }?>>Désactivé</option>
</select>
<input type="hidden" name="form_id" value="8">
<input type="hidden" name="product_id" value="<?=$product->id?>">
- <img src="<?=base_url()?>/resources/imgs/delete.png" height="13"/><input type="button" value="supprimer" onclick="delete_product(<?=$product->id?>)" />
</form>
<form action=""  name="deleteproduct" method="post">
	<input type="hidden" name="form_id" value="9">
	<input type="hidden" name="product_id" value="<?=$product->id?>">
</form>
<hr>
<form action="" method="post" >
<label>Nom du product</label><input type="text" name="product_name" value="<?=$product->product_name?>">
<label>Numéro du product</label><input type="text" name="product_num" value="<?=$product->product_num?>">
<label>Prix</label><input type="text" name="product_price" value="<?=$product->product_price?>"> €
<label>Description</label><textarea name="capture" rows="10" cols="30"><?=$product->capture?></textarea>
<input type="hidden" name="id" value="<?=$product->id?>">
<input type="hidden" name="form_id" value="1">
<br><br>
<input type="submit" value="modifier">
 <p class="msg"><?php if(isset($msg)){echo $msg;}?></p>
</form> 
 
 </div>
 <div class="product_attribute">
 <h3>Options du produit:</h3>
 	<label>ajouter une option</label> 
	<form action="" method="post">
	<input type="text" name="attribute_group_name" value=""> 
	<input type="hidden" name="product_id" value="<?=$product->id?>" />
	<input type="hidden" name="form_id" value="2" />
	<input type="submit" value="ajouter">
	</form>
	<hr>
<?php foreach ($product->attribute_group_admin as $group):?>
<form action="" method="post" name="status_<?=$group->id?>">
	<h4>
	<?php if($group->status != null){?><img src="<?=base_url()?>/resources/imgs/block_yes.png" height="14" alt="disponible" title="disponible"><?php }else{?><img src="<?=base_url()?>/resources/imgs/block_no.png" height="12" alt="non disponible" title="non disponible"> <?php }?>
	 <?=$group->attribute_group_name?> 
	<select name="status" onchange="document.status_<?=$group->id?>.submit()">
	<option <?php if($group->status == 1){echo 'selected="selected"';}?> value="1">activé</option>
	<option <?php if(!$group->status){echo 'selected="selected"';}?> value="null">désactivé</option>
	</select>
	<input type="hidden" name="form_id" value="3" />
	<input type="hidden" name="group_id" value="<?=$group->id?>" />
	</form> - <img src="<?=base_url()?>/resources/imgs/delete.png" height="13"/><input type="button" value="supprimer" onclick="document.delete_<?=$group->id?>.submit()" />
	</h4> 
	<form action="" method="post" name="delete_<?=$group->id?>">
	<input type="hidden" name="form_id" value="4" />
	<input type="hidden" name="group_id" value="<?=$group->id?>" />
	<input type="hidden" name="url" value="<?=$url?>" />
	</form>
	
	
	<?php foreach ($group->attribute_product as $key=>$product_attribute):?>
	<form action="" method="post" name="attribute_update_<?=$product_attribute->id?>">
	<?=($key+1)?>. <input type="text" name="attribute_name" value="<?=$product_attribute->attribute_name?>" /> <input name="attribute_price" type="text" value="<?=number_format($product_attribute->attribute_price,'2','.','')?>" style="width:50px;" /> € 
	<input type="hidden" name="form_id" value="5" />
	<input type="hidden" name="attribute_id" value="<?=$product_attribute->id?>" />
	<a href="#" onclick="document.attribute_update_<?=$product_attribute->id?>.submit()"><img src="<?=base_url()?>/resources/imgs/arrow_circle_double.png" height="12" title="mise à jour"/></a> | <a href="#" onclick="document.attribute_delete_<?=$product_attribute->id?>.submit()"><img src="<?=base_url()?>/resources/imgs/delete.png" height="12" title="supprimer"/></a>
	</form>
	<form action="" method="post" name="attribute_delete_<?=$product_attribute->id?>">
	<input type="hidden" name="form_id" value="6" />
	<input type="hidden" name="url" value="<?=$url?>" />
	<input type="hidden" name="attribute_id" value="<?=$product_attribute->id?>" />
	</form>
	<?php endforeach;?>	
	<form action="" method="post">
	+<?=nbs(2)?><input type="text" name="attribute_name" value="" /> <input name="attribute_price" type="text" value="0.00" style="width:50px;"/> €
	<input type="hidden" name="group_id" value="<?=$group->id?>" />
	<input type="hidden" name="form_id" value="7" />
	<input type="hidden" name="url" value="<?=$url?>" />
	<input type="submit" value="ajouter">
	</form>
	<hr>
<?php endforeach;?>




</div>
<div class="clear"></div>

</div>
</body>
</html>